﻿using System;
using System.Runtime.InteropServices;
using System.Text;

namespace CoreShop.App.Scale
{

    class DingjianClass
    {
        public delegate void SensorInfo(double NetWeight, double Tare, double Grossweight, int Mode, int DecimalDigit, int UnitChar,
                             int OldAd, int FilterAd, int ZeroAd, int WeightAd, int flag);
        public delegate void IS1Info(string status, string sign, string Weight, string fUnit,int flag);

        [DllImport("SensorDll.dll",CharSet=CharSet.Ansi,CallingConvention=CallingConvention.StdCall)]
        public extern static bool __Open(string CommName, int BaudRate);//打开端口  

        [DllImport("SensorDll.dll")]
        public extern static bool __Close();//关闭

        [DllImport("SensorDll.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public extern static bool __GetWeightEx(StringBuilder ret);//获取重量，称状态，单位，从参数传回


        [DllImport("SensorDll.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public extern static bool __ReadTare(string Id,StringBuilder ret);//读取皮重


        [DllImport("SensorDll.dll")]
        public extern static bool __Zero(string Id);//归零

        [DllImport("SensorDll.dll")]
        public extern static bool __Tare(string Id);//去皮

        [DllImport("SensorDll.dll")]
     
        public extern static void __SetCallBackFunc(string funcId, Delegate funcInfo);   //设置回调函数功能


        [DllImport("SensorDll.dll")]
        public extern static bool __SetCommMode(UInt16 iMode);
        

        [DllImport("SensorDll.dll")]
        public extern static IntPtr GetWeight();//// 

    }
}
